home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / finddosentry.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  3KB  |  105 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: finddosentry.c,v 1.6 1996/10/24 15:50:28 aros Exp $
  4.     $Log: finddosentry.c,v $
  5.     Revision 1.6  1996/10/24 15:50:28  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.5  1996/10/10 13:20:49  digulla
  9.     Use dol_DevName(STRPTR) instead of dol_Name(BSTR) (Fleischer)
  10.  
  11.     Revision 1.4  1996/09/11 12:58:46  digulla
  12.     Determine the size of the name (M. Fleischer)
  13.  
  14.     Revision 1.3  1996/08/13 13:52:46  digulla
  15.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  16.     Replaced AROS_LA by AROS_LHA
  17.  
  18.     Revision 1.2  1996/08/01 17:40:51  digulla
  19.     Added standard header for all files
  20.  
  21.     Desc:
  22.     Lang: english
  23. */
  24. #include <dos/dosextens.h>
  25. #include <clib/utility_protos.h>
  26. #include "dos_intern.h"
  27.  
  28. /*****************************************************************************
  29.  
  30.     NAME */
  31.     #include <clib/dos_protos.h>
  32.  
  33.     AROS_LH3(struct DosList *, FindDosEntry,
  34.  
  35. /*  SYNOPSIS */
  36.     AROS_LHA(struct DosList *, dlist, D1),
  37.     AROS_LHA(STRPTR,           name,  D2),
  38.     AROS_LHA(ULONG,            flags, D3),
  39.  
  40. /*  LOCATION */
  41.     struct DosLibrary *, DOSBase, 114, Dos)
  42.  
  43. /*  FUNCTION
  44.     Looks for the next dos list entry with the right name. The list
  45.     must be locked for this. There may be not more than one device
  46.     or assign node of the same name. There are no restrictions on
  47.     volume nodes.
  48.  
  49.     INPUTS
  50.     dlist - the value given by LockDosList() or the last call to
  51.             FindDosEntry().
  52.     name  - logical device name without colon. Case insensitive.
  53.     flags - the same flags as given to LockDosList() or a subset
  54.             of them.
  55.  
  56.     RESULT
  57.     Pointer to dos list entry found or NULL if the are no more entries.
  58.  
  59.     NOTES
  60.  
  61.     EXAMPLE
  62.  
  63.     BUGS
  64.  
  65.     SEE ALSO
  66.  
  67.     INTERNALS
  68.  
  69.     HISTORY
  70.     29-10-95    digulla automatically created from
  71.                 dos_lib.fd and clib/dos_protos.h
  72.  
  73. *****************************************************************************/
  74. {
  75.     AROS_LIBFUNC_INIT
  76.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  77.     
  78.     static const ULONG flagarray[]=
  79.     { LDF_DEVICES, LDF_ASSIGNS, LDF_VOLUMES, LDF_ASSIGNS, LDF_ASSIGNS };
  80.     
  81.     /* Determine the size of the name (-1 if the last character is a ':') */
  82.     STRPTR end=name;
  83.     ULONG size;
  84.     while(*end++)
  85.         ;
  86.     size=~(name-end);
  87.     if(size&&*--end==':')
  88.         size--;
  89.  
  90.     /* Follow the list */   
  91.     for(;;)
  92.     {
  93.         /* Get next entry. Return NULL if there is none. */
  94.     dlist=dlist->dol_Next;
  95.     if(dlist==NULL)
  96.         return NULL;
  97.  
  98.     /* Check type and name */
  99.     if(flags&flagarray[dlist->dol_Type]&&
  100.        !Strnicmp(name,dlist->dol_DevName,size)&&!dlist->dol_DevName[size])
  101.         return dlist;
  102.     }
  103.     AROS_LIBFUNC_EXIT
  104. } /* FindDosEntry */
  105.